const a = async () => {
  await new Promise((resolve) => {
    setTimeout(() => {
      resolve(1111);
    }, 1000);
  });
};
export default {
  namespaced: true,
  state: {
    module1: 1,
  },
  getters: {
    modulecopy(state, getters) {
      return state.module1 + 1;
    },
  },
  mutations: {
    setModules(state, pre) {
      console.log(pre);
      state.module1 = pre;
    },
  },
  actions: {
    setDataM1(store, params) {
      console.log(store, params);
      store.commit("setModules", params);
      // store.commit('module2/setModules' , params  ,{root:true})
      store.dispatch("module2/setDataM1", params, { root: true });
    },
    async setDataM11(store, params) {
      let resolve1 = null;
      let promise = new Promise((resolve, reject) => {
        resolve1 = resolve;
      });
      console.log(promise, 221211);
      await a();

      resolve1(1111);
      return promise;
    },
  },
};
